//
//  File.swift
//
//
//  Created by didi on 2022/9/8.
//

import MolecularObjects
import Vapor

public struct ValidationAbort: AbortError {
    public var abort: Abort
    public var message: String?
    public var details: [ErrorDetail]

    public var reason: String { abort.reason }
    public var status: HTTPResponseStatus { abort.status }

    public init(abort: Abort, message: String? = nil, details: [ErrorDetail]) {
        self.abort = abort
        self.message = message ?? abort.reason
        self.details = details
    }
}
